
FROM registry.openanolis.cn/openanolis/anolisos:23

LABEL \
    maintainer="OpenAnolis AI SIG" \
    org.opencontainers.image.title="xfastertransformer" \
    org.opencontainers.image.version="1.8.1-23"

RUN dnf install anolis-epao-release -y
RUN dnf install -y wget numactl python3-pip git vim level-zero-devel procps-ng
RUN ln /usr/bin/python3 /usr/bin/python
RUN pip3 install --no-cache-dir torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu
RUN pip3 install --no-cache-dir transformers==4.43.3 sentencepiece==0.2.0 accelerate==0.31.0 protobuf==4.25.3 tiktoken==0.6.0
RUN pip3 install --no-cache-dir xfastertransformer==1.8.1

RUN echo $'\
[oneAPI]\n\
name=Intel(R) oneAPI repository\n\
baseurl=https://yum.repos.intel.com/oneapi\n\
enabled=1\n\
gpgcheck=1\n\
repo_gpgcheck=1\n\
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB' \
> /etc/yum.repos.d/oneAPI.repo

RUN dnf install -y intel-oneapi-ccl-2021.10.0 intel-oneapi-compiler-dpcpp-cpp-runtime-2023.2.1

RUN echo 'source /opt/intel/oneapi/setvars.sh' >> /root/.bashrc
RUN echo "export \$(python -c 'import xfastertransformer as xft; print(xft.get_env())')" >> ~/.bashrc

WORKDIR /root/

RUN git clone --depth 1 -b v1.8.1 https://github.com/intel/xFasterTransformer.git

CMD ["/bin/bash"]